import Vue from 'vue'
import VueRouter from 'vue-router'


//懒加载各个组件
const Home  = ()=> import("views/home/Home.vue")
const Category = ()=> import("views/category/Category.vue")
const ShopCart = ()=> import("views/shopcart/ShopCart.vue")
const Profile = ()=> import("views/profile/Profile.vue")
const HomeDetail = ()=> import("views/home/homedetail/HomeDetail.vue")


Vue.use(VueRouter)

const routes = [
  {
    path:'',
    redirect:'/home'
  },{
    path:'/home',
    component: Home
  },{
    path:'/category',
    component: Category
  },{
    path:'/shopcart',
    component: ShopCart
  },{
    path:'/profile',
    component: Profile
  },{
    path:'/homedetail/:sku',
    component:HomeDetail
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
